package com.liusu.spider.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RE {
    /**
     * 用正则表达式提取一行中的特殊内容
     * @param content
     * @param pattern
     * @return
     */
    public static String search(String content,String pattern){
        Pattern regular = Pattern.compile(pattern);
        Matcher matcher = regular.matcher(content);
        while (matcher.find()){
            String group = matcher.group(1);
            return group;
        }
        return null;
    }
}
